package learn.spring.api.controller;


import java.util.List;
import learn.spring.api.service.IRoleService;
import learn.spring.common.base.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author chins
 * @since 2021-12-18
 */
@RestController
@RequestMapping("/api/role")
public class RoleController {

  @Autowired
  private IRoleService roleService;

  @PostMapping("")
  public Result getAllRoles(@RequestBody List<String> roleIds) {
    List<String> rolesByIds = roleService.getRolesByIds(roleIds);
    return Result.success().data("roles", rolesByIds);
  }
}
